#include <QMessageBox>
#include <QMenu>
#include <QMenuBar>
#include <QToolBar>
#include "CentralWidget.h"
#include "mainwindow.h"

MainWindow::MainWindow() : QMainWindow(NULL)
{
    m_all = new QAction("All", this);
    m_fall = new QAction ("Fall", this);
    m_summer = new QAction ("Summer", this);
    m_winter = new QAction ("Winter", this);
    m_spring = new QAction ("Spring", this);

    QMenu *menu=new QMenu("Actions", this);
    menu->addAction(m_all);
    menu->addAction(m_winter);
    menu->addAction(m_fall);
    menu->addAction(m_summer);
    menu->addAction(m_spring);

    menuBar()->addMenu(menu);

    connect(m_all, SIGNAL(triggered()), SLOT(showAll()));
    connect(m_winter, SIGNAL(triggered()), SLOT(showWinter()));
    connect(m_fall, SIGNAL(triggered()), SLOT(showFall()));
    connect(m_summer, SIGNAL(triggered()), SLOT(showSummer()));
    connect(m_spring, SIGNAL(triggered()), SLOT(showSpring()));

    QToolBar *full= addToolBar("full");
    full->addAction(m_all);
    full->addAction(m_winter);

    QToolBar *partial = addToolBar("partial");
    partial->addAction(m_summer);
    partial->addAction(m_winter);
}

void MainWindow::showAll()
{
    setCentralWidget(new CentralWidget(this));
    //QMessageBox::information(this, "info", "all");
}

void MainWindow::showSummer()
{
    setCentralWidget(new CentralWidget(this, 9));
}

void MainWindow::showWinter()
{
     setCentralWidget(new CentralWidget(this, 3));
}

void MainWindow::showSpring()
{
    setCentralWidget(new CentralWidget(this, 6));
}

void MainWindow::showFall()
{
    setCentralWidget(new CentralWidget(this, 12));
}
